//package com.etrans.web.gps.business.report.controller;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import com.alibaba.fastjson.JSON;
//import com.etrans.web.gps.base.controller.BaseController;
//import com.etrans.web.gps.business.report.domain.AnalysisVo;
//import com.etrans.web.gps.business.report.domain.VehicleParkingVO;
//import com.etrans.web.gps.business.report.service.VehicleParkingService;
//import com.etrans.web.gps.business.system.domain.SysUser;
//import com.etrans.web.gps.common.Constant;
//import com.etrans.web.gps.util.TimeFormatUtils;
//import com.etrans.web.gps.util.grid.FlexiGridUtil;
//
//@Controller
//@RequestMapping("/report/VehicleParking/*")
//public class VehicleParkingController  extends BaseController {
//	
//	@Autowired
//	private VehicleParkingService vehicleParkingService;
//	
//	/**
//	 * 车辆停车分析
//	 * @Description 页面跳转
//	 * @param model
//	 * @return
//	 */
//	@RequestMapping(value="getVehicleParking.html")
//	public String getVehicleParking(Model model){
//		String returnUrl="views/business/report/vehicleParking";
//		return returnUrl;
//	}
//	
//	/**
//	 * @Description 根据用户查询停车信息
//	 *  @param paramsGrid 
//	 */
//	@RequestMapping("queryVehicleParkingList.html")
//	@ResponseBody
//	public Map<String, Object> queryVehicleParkingList(String paramsGrid){
//		Map<String, Object> reslut = new HashMap<>();
//		Map<String, Object> param =  FlexiGridUtil.parseJSONParam(paramsGrid).getWhereParam();
//		SysUser user = (SysUser)getSession().getAttribute(Constant.LOGIN_SESSION_NAME);
//		param.put("userId", user.getId());
//
//		List<VehicleParkingVO> vehicleParkingList = new ArrayList<VehicleParkingVO>();
//		vehicleParkingList=vehicleParkingService.queryVehicleParkingList(param);
//		reslut.put("rows", vehicleParkingList);
////		reslut.put("page", param.get("page"));
////		reslut.put("total", vehicleParkingService.queryVehicleParkingListCount(param));
//        return  reslut;
//	}
//	
//	
//	/**
//	 * @Description 根据用户查询停车信息
//	 *  @param paramsGrid 
//	 */
//	@RequestMapping("queryVehicleParkingListTable.html")
//	@ResponseBody
//	public List<VehicleParkingVO> queryVehicleParkingListTable(String vehicleID,String startTime,String endTime,String timeSplit,String timeCount){
//		Map<String, Object> param =  new HashMap<String, Object>();
//		SysUser user = (SysUser)getSession().getAttribute(Constant.LOGIN_SESSION_NAME);
////		int fromNumber=Integer.parseInt(pageSize)*(Integer.parseInt(pageNum)-1);
////		int psize=Integer.parseInt(pageSize);
//		param.put("userId", user.getId());
//		param.put("vehicleID", vehicleID);
//		param.put("endTime", endTime);
//		param.put("startTime",startTime);
//		param.put("timeSplit",timeSplit);
//		param.put("timeCount",timeCount);
////		param.put("fromNumber",fromNumber);
////		param.put("pageSize",psize);
//		List<VehicleParkingVO> vehicleParkingList = new ArrayList<VehicleParkingVO>();
//		vehicleParkingList=vehicleParkingService.queryVehicleParkingList(param);
////		for(VehicleParkingVO temp:vehicleParkingList){
////			temp.setId(temp.getId()+fromNumber);
////		}
//        return  vehicleParkingList;
//	}
//	
//	private String getTimeFormat(double ms){
//		String result="";
//		 int day=(int)ms/(24*3600);
//		 int hour =(int)(ms-day*24*3600)/3600;  
//		 int minute =(int)(ms-day*24*3600-hour*3600)/60;  
//		 int second = (int)(ms-day*24*3600-hour*3600-minute*60);  	
//		 if(day==0){
//			 result= hour+"小时"+minute+"分"+second+"秒";
//		 }else{
//			 result=day+"天" +hour+"小时"+minute+"分"+second+"秒";
//		 }
//		 
//	return result;
//	}
//
//	/**
//	 * 导出报表
//	 * @return
//	 */
//	@RequestMapping(value="exportVehicleParking.html")
//	@ResponseBody
//	public void exportVehicleParking(HttpServletResponse response,HttpServletRequest request, String vehicleID, String startTime, String timeSplit, String timeCount, String endTime, String colModel,
//			String title,String imgsrc ){
//		List<String> colModelList = JSON.parseObject(colModel, List.class);
//		List<String> imgsrcList   = null;
//		SysUser user = (SysUser)getSession().getAttribute(Constant.LOGIN_SESSION_NAME);
//
//		
//		Map<String, Object> paramMap=new HashMap<String, Object>();
//		paramMap.put("vehicleID", vehicleID);
//		paramMap.put("startTime",startTime);
//		paramMap.put("timeSplit", timeSplit);
//		paramMap.put("timeCount", timeCount);
//		paramMap.put("endTime",endTime);
//		paramMap.put("userId", user.getId());
//		paramMap.remove("fromNumber");
//		paramMap.remove("pageSize");
//		List<VehicleParkingVO> vehicleParkingList = new ArrayList<VehicleParkingVO>();
//		vehicleParkingList=vehicleParkingService.queryVehicleParkingList(paramMap);
//		List<HashMap<String, String>> rows = new ArrayList<HashMap<String, String>>();
//		
//		for(VehicleParkingVO obj : vehicleParkingList){
//			HashMap<String, String> map = new HashMap<String, String>();
//			
//			map.put("id", obj.getId()+"");
//			map.put("registrationNO", obj.getRegistrationNO());
//			map.put("internal_number", obj.getInternal_number());
//			map.put("workUnitName", obj.getWorkUnitName());
//			map.put("start_time", obj.getStart_time().substring(0, 19));
//			map.put("end_time",  obj.getEnd_time().substring(0, 19));		
//			map.put("duration", getTimeFormat(obj.getDuration()));
//
//			
//			rows.add(map);
//		}
//		
//		int index=-1;
//		List rowsList = new ArrayList<>();
//		rowsList.add(rows);
//		exportExl(request, response,title, removeHeadName(colModelList,index,-1),rowsList,imgsrcList);
//		
//		
//	}
//	
//	
//	
//}
